import java.util.Arrays;

class  Solution {
    public int missingNumber(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i <nums.length ; i++) {
            if(nums[i+1]-nums[i]==2){
                return nums[i+1] -1;
            }
        }
        return -1;
    }



    public void rotate(int[] nums, int k) {
        int right = nums.length-1;
        for(int i = 0;i <= k;i++){
            nums[0] = nums[right];
            nums[i+1]=nums[i];
        }
    }



}


public class Test {
    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        reverse(nums, 0, n - 1);
        reverse(nums, 0, k - 1);
        reverse(nums, k, n - 1);
    }
    public static void reverse(int[] nums, int start, int end) {
        while (start < end) {
            int temp = nums[start];
            nums[start] = nums[end];
            nums[end] = temp;
            start++;
            end--;
        }
    }
    public static void main(String[] args) {


        int[] array = {1,2,3,4,5,6,7};
        rotate(array,3);
        System.out.println(Arrays.toString(array));

    }
    public static void main3(String[] args) {
        Integer a = 100;
        Integer b = 100;
        System.out.println(a == b);

        Integer a2 = 128;
        Integer b2 = 128;//超过数组的元素，会返回一个新的对象
        System.out.println(a2 == b2);
    }

    public static void main2(String[] args) {
        Integer a = new Integer(10);
        int b = a;//自动拆箱
        System.out.println(b);

        //显示拆箱 拆箱为自己指定的元素
        int c = a.intValue();
        System.out.println(c);

        double d = a.doubleValue();
        System.out.println(d);


    }
    public static void main1(String[] args) {
        //装箱：把一个基本数据类型 转化为 包装类型的过程
        //自动装箱  &  显示装箱
        int a = 10;
        Integer b = a;//自动装箱
        System.out.println(b);

        Integer c = Integer.valueOf(a);//显示装箱
        System.out.println(c);

    }
}
